<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>访问CSS</title>
    <style>
        .checked{
            width: 400px;
            height: 200px;
            background-color: green;
        }
    </style>
    <script>
        function f1(){
            let d1 = document.getElementById("d1");
            // d1.className = "checked";
            d1.style.width = "400px";
            d1.style.height = "200px";
            d1.style.backgroundColor = "green";
        }
        function f2(){
            let image = document.getElementById("image");
            console.log("left:"+image.style.left);
            image.style.left = parseInt(image.style.left) + 50 + "px";
        }
    </script>
</head>
<body>
<div id="d1" style="width: 200px;height: 100px;background-color: red;" onclick="f1()"></div>
<img id="image" style="position: relative;left: 0px;" src="../images/heihei.gif" alt="图片加载失败" onclick="f2()">
</body>
</html>